package com.briup;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.InputStream;

public class UpdateById {
  public static void main(String[] args) {
      String resource = "mybatis-config.xml";
    SqlSession sqlSession = null;
    try (InputStream inputStream = Resources.getResourceAsStream(resource)) {
      SqlSessionFactory build = new SqlSessionFactoryBuilder().build(inputStream);

       sqlSession = build.openSession(true);
      StuMapper mapper = sqlSession.getMapper(StuMapper.class);
     int a = mapper.update(new Student(2,"xxx","女","1111"));
      System.out.println(a);
    }catch (Exception e){
      e.printStackTrace();
    }finally{
      sqlSession.close();
    }

  }
}
